import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AppVersionVO, AppVersionForm, AppVersionQuery } from '@/api/retail/appVersion/types';

/**
 * 查询APP版本列表
 * @param query
 * @returns {*}
 */

export const listAppVersion = (query?: AppVersionQuery): AxiosPromise<AppVersionVO[]> => {
  return request({
    url: '/retail/appVersion/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询APP版本详细
 * @param id
 */
export const getAppVersion = (id: string | number): AxiosPromise<AppVersionVO> => {
  return request({
    url: '/retail/appVersion/' + id,
    method: 'get'
  });
};

/**
 * 新增APP版本
 * @param data
 */
export const addAppVersion = (data: AppVersionForm) => {
  return request({
    url: '/retail/appVersion',
    method: 'post',
    data: data
  });
};

/**
 * 修改APP版本
 * @param data
 */
export const updateAppVersion = (data: AppVersionForm) => {
  return request({
    url: '/retail/appVersion',
    method: 'put',
    data: data
  });
};

/**
 * 删除APP版本
 * @param id
 */
export const delAppVersion = (id: string | number | Array<string | number>) => {
  return request({
    url: '/retail/appVersion/' + id,
    method: 'delete'
  });
};
